package com.bingo.users.action;

import ibatis.Users;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.struts2.interceptor.ParameterAware;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.SessionAware;

import com.bingo.facade.InewsFacade;
import com.bingo.facade.IusersFacade;
import com.googlecode.jsonplugin.annotations.JSON;
import com.opensymphony.xwork2.ActionSupport;

public class GetUsersList extends ActionSupport {
	private IusersFacade usersFacade;
	private Map<String, List> usersMap = new HashMap<String, List>();

	public void setUsersFacade(IusersFacade usersFacade) {
		this.usersFacade = usersFacade;
	}
	private Integer page;
	private Integer total;
	
	private List<Users> userList;
	@JSON(name="rows")
	public List<Users> getUserList() {
		return userList;
	}

	public void setUserList(List<Users> userList) {
		this.userList = userList;
	}
	
	public Map<String, List> getUsersMap() {
		return usersMap;
	}

	public void setUsersMap(Map<String, List> usersMap) {
		this.usersMap = usersMap;
	}

	@Override
	public String execute() throws Exception {
		try {
			System.out.println("getAllUsers");
			userList=this.usersFacade.getAllUsers();
			page=1;
			total=200;
			//request.put("userList",list);
			//this.id=list.get(0).getUid();
			//this.name=list.get(0).getUsername();
			//this.email=list.get(0).getUseremail();
		} catch (Exception e) {
			e.printStackTrace();
			return "error";
		}
		return SUCCESS;
	}

	public Integer getPage() {
		return page;
	}

	public void setPage(Integer page) {
		this.page = page;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}
	
}
